package com.cqq.print.base.service.impl;


import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cqq.common.core.bean.PageInfoBean;
import com.cqq.print.base.dao.PPublisherDao;
import com.cqq.print.base.dao.domain.PPublisher;
import com.cqq.print.base.service.bean.PPublisherBean;


/**
 * @author generated
 * @date 2015-07-01
 */


@Service(value="pPublisherService")
public class PPublisherServiceImpl implements com.cqq.print.base.service.PPublisherService{

             @Autowired
             private PPublisherDao pPublisherDao;

			
			public PageInfoBean<PPublisherBean> queryPagePPublisher(
					Map<String, Object> map) {
				List<PPublisherBean> listPPBean = null;
				List<PPublisher> listPP = pPublisherDao.queryPPublisher(map);
				int count = pPublisherDao.queryPPublisherCount(map);
				if(listPP!=null && listPP.size()>0){
					listPPBean = new ArrayList<PPublisherBean>();
					for (PPublisher pp : listPP) {
						PPublisherBean ppBean = new PPublisherBean();
						BeanUtils.copyProperties(pp, ppBean);
						listPPBean.add(ppBean);
					}
				}
				
				return new PageInfoBean<PPublisherBean>(listPPBean, count);
			}

			
			public int insertSelective(PPublisherBean ppBean) {
				if(ppBean==null){
					return 0;
				}
				PPublisher pp = new PPublisher();
				BeanUtils.copyProperties(ppBean, pp);
				return pPublisherDao.insertSelective(pp);
			}

			
			public void updateById(PPublisherBean ppBean) {
				if(ppBean!=null&&ppBean.getId()>0){					
					PPublisher pp = new PPublisher();
					BeanUtils.copyProperties(ppBean, pp);
					pPublisherDao.updateByPrimaryKeySelective(pp);
				}
			}

			
			public PPublisherBean queryById(int id) {
				PPublisher pp = pPublisherDao.selectByPrimaryKey(id);
				PPublisherBean ppBean = new PPublisherBean();
				BeanUtils.copyProperties(pp, ppBean);
				return ppBean;
			}

			
			public List<PPublisherBean> queryPPublishers(Map<String, Object> map) {
				List<PPublisherBean> listPPBean = null;
				List<PPublisher> listPP = pPublisherDao.queryPPublishers(map);
				if(listPP!=null && listPP.size()>0){
					listPPBean = new ArrayList<PPublisherBean>();
					for (PPublisher pp : listPP) {
						PPublisherBean ppBean = new PPublisherBean();
						BeanUtils.copyProperties(pp, ppBean);
						listPPBean.add(ppBean);
					}
				}
				return listPPBean;
			}

}